<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessageXUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('message_x_user', function (Blueprint $table) {
            $table->increments('id');
            $table -> integer('user_id')->default(0)->comment('用户id');
            $table -> integer('message_id')->nullable()->comment('消息id');
            $table -> softDeletes();
            $table->timestamps();
        });

        Schema::table('message', function(Blueprint $table)
        {
            $table->integer('system_message_type')->default(0)->comment('系统消息类型 0：发给所有人 1：发给个别人')->after('type');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
